define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_group_dealer(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": {"act": [' +
					'{"order_id": "001","act_id": "001","name": "促销","status": "活动中","start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","goods": [' +
					'{"id": "001","name": "一字螺丝刀","image": "./img/upload/pro-img01.jpg","price": 10.5,"groupbuy_price": 10,"count": 1000,"need_count": 10,"status": "购买"},' +
					'{"id": "002","name": "十字螺丝刀","image": "./img/upload/pro-img01.jpg","price": 10.5,"groupbuy_price": 10,"count": 1000,"need_count": 10,"status": "购买"}]},' +
					'{"order_id": "002","act_id": "001","name": "促销","status": "活动中","start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","goods": [' +
					'{"id": "001","name": "一字螺丝刀","image": "./img/upload/pro-img01.jpg","price": 10.5,"groupbuy_price": 10,"count": 1000,"need_count": 10,"status": "购买"},' +
					'{"id": "002","name": "十字螺丝刀","image": "./img/upload/pro-img01.jpg","price": 10.5,"groupbuy_price": 10,"count": 1000,"need_count": 10,"status": "购买"}]}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		//返回信息
		return {
			//获取首页数据
			group_dealer: function(callback) {
				//post请求
				Http.post({
					method: 'marketing.groupbuy.jionlist',
					session: '',
					pagelimit: 8,
					nPage: 1,
					show_count: 5
				}, function(result) {
					//函数回调
					if(callback)
						callback(get_data_group_dealer(result).result);
				},function(e){
					
				},function(){
					
				});
			},
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Mygroupbuy_dealer", factory);
});